<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>数据模型管理系统 | Log in</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Font Awesome -->
    <link rel="stylesheet" href="/AdminLTE-3.0.5/plugins/fontawesome-free/css/all.min.css">

    <!-- icheck bootstrap -->
    <link rel="stylesheet" href="/AdminLTE-3.0.5/plugins/icheck-bootstrap/icheck-bootstrap.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="/AdminLTE-3.0.5/dist/css/adminlte.min.css">
    <link rel="stylesheet" href="/dist/admin/css/optimization.css">

</head>
<body class="hold-transition login-page">
<div class="login-box">
    <div class="login-logo">
        <a href="/AdminLTE-3.0.5/index2.html"><b>Admin</b>LTE</a>
    </div>
    <!-- /.login-logo -->
    <div class="card">
        <div class="card-body login-card-body">
            <p class="login-box-msg">管理登录入口</p>

            <form action="/admin/entrance/login" method="post" id="login_form">
                <div class="input-group mb-3">
                    <input name="username" type="text" class="form-control" placeholder="用户名">
                    <div class="input-group-append">
                        <div class="input-group-text">
                            <span class="fas fa-envelope"></span>
                        </div>
                    </div>
                </div>
                <div class="input-group mb-3">
                    <input name="password" type="password" class="form-control" placeholder="密码">
                    <div class="input-group-append">
                        <div class="input-group-text">
                            <span class="fas fa-lock"></span>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-8">
                        <div class="icheck-primary">
                            <!--<input type="checkbox" id="remember">-->
                            <!--<label for="remember">-->
                                <!--记录登录-->
                            <!--</label>-->
                        </div>
                    </div>
                    <!-- /.col -->
                    <div class="col-4">
                        <button type="button" class="btn btn-primary btn-block submit">登录</button>
                    </div>
                    <!-- /.col -->
                </div>
            </form>

            <!--<p class="mb-1">-->
            <!--<a href="forgot-password.html">I forgot my password</a>-->
            <!--</p>-->
            <!--<p class="mb-0">-->
            <!--<a href="register.html" class="text-center">Register a new membership</a>-->
            <!--</p>-->
        </div>
        <!-- /.login-card-body -->
    </div>
</div>
<!-- /.login-box -->

<!-- jQuery -->
<script src="/AdminLTE-3.0.5/plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="/AdminLTE-3.0.5/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="/AdminLTE-3.0.5/dist/js/adminlte.min.js"></script>

<link rel="stylesheet" href="/plugins/jquery-toast-plugin-1.3.2/dist/jquery.toast.min.css">
<script src="/plugins/jquery-toast-plugin-1.3.2/dist/jquery.toast.min.js"></script>
<script src="/dist/js/admin.common.js"></script>
<script>
    $(function () {
        $(".submit").bind('click', function () {
            let url = window.location.origin + "/adminRest/v1/token";
            $.ajax({
                url: url,
                type: 'POST',
                async: true,
                data: $('#login_form').serialize(),
                success: function (res) {
                    if (200 === res.code) {
                        window.localStorage.site_admin_token = res.data.token;
                        // window.localStorage.site_admin_name = res.data.info.name;
                        window.location.href = window.location.origin + "/admin/index.html";
                    } else {
                        showToast(res.msg);
                    }
                }
            })
        })
    });
</script>
</body>
</html>
